﻿using Core.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace Core.IService
{
    public interface IBaseService<T> where T : BaseModel, new()
    {
        Task<int> AddAsync<DTO>(DTO obj);
        Task<int> EditAsync<DTO>(DTO obj);
        Task<int> DeleteAsync(int id);

        /// <summary>
        ///  标记删除
        /// </summary>
        Task<int> MarkDeleteAsync(int id);

        bool Exists(int id);

        Task<T> GetEntityAsync(Expression<Func<T, bool>> expression);
        Task<T> GetEntityAsync(int id);

        IQueryable<T> GetList(Expression<Func<T, bool>> expression=null);

        IQueryable<T> GetList<TOrder>(Expression<Func<T, bool>> expression, int pageSize, int pageIndex, out int total, Expression<Func<T, TOrder>> order=null, bool IsAsc = true);
    }
}
